# # 集群安装
kubectl create namespace argo-events
kubectl apply -f https://raw.fgit.cf/argoproj/argo-events/stable/manifests/install.yaml
# 验证准入网络钩子
kubectl apply -f https://raw.fgit.cf/argoproj/argo-events/stable/manifests/install-validating-webhook.yaml

# # 命名空间安装
# kubectl create namespace argo-events
# kubectl apply -f https://raw.fastgit.org/argoproj/argo-events/stable/manifests/namespace-install.yaml
# # Deploy Argo Events SA, ClusterRoles, and Controller for Sensor, EventBus, and EventSource
# kubectl apply -n argo-events -f https://raw.fastgit.org/argoproj/argo-events/stable/examples/eventbus/native.yaml
# # 部署事件总线
# kubectl apply -n argo-events -f https://raw.fastgit.org/argoproj/argo-events/stable/examples/eventbus/native.yaml

# 部署事件总线
kubectl apply -n argo-events -f https://raw.fgit.cf/argoproj/argo-events/stable/examples/eventbus/native.yaml
# 创建事件源
# 设置 Webhook 的事件源
kubectl apply -n argo-events -f https://raw.fgit.cf/argoproj/argo-events/stable/examples/event-sources/webhook.yaml

# 例子
# 使用 RBAC 设置创建服务帐户，以允许传感器触发工作流，并允许工作流运行

# sensor rbac
kubectl apply -n argo-events -f https://raw.fgit.cf/argoproj/argo-events/master/examples/rbac/sensor-rbac.yaml
# workflow rbac
kubectl apply -n argo-events -f https://raw.fgit.cf/argoproj/argo-events/master/examples/rbac/workflow-rbac.yaml

kubectl apply -n argo-events -f https://raw.fgit.cf/argoproj/argo-events/stable/examples/sensors/webhook.yaml

# kubectl -n argo-events port-forward $(kubectl -n argo-events get pod -l eventsource-name=webhook -o name) 12000:12000 &

# curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example

# kubectl -n argo-events get workflows | grep "webhook"
